bn.fit, bn.fit.dnode, bn.fit.gnode,
bn.fit.cgnode or bn.fit.onode.## methods available for "bn.fit"
## S3 method for class 'bn.fit':
fitted(object, ...)
## S3 method for class 'bn.fit':
coef(object, ...)
## S3 method for class 'bn.fit':
residuals(object, ...)
## S3 method for class 'bn.fit':
sigma(object, ...)
## S3 method for class 'bn.fit':
predict(object, node, data, method = "parents", ..., debug = FALSE)
## S3 method for class 'bn.fit':
logLik(object, data, nodes, by.sample = FALSE, ...)
## S3 method for class 'bn.fit':
AIC(object, data, ..., k = 1)
## S3 method for class 'bn.fit':
BIC(object, data, ...)## methods available for "bn.fit.dnode"
## S3 method for class 'bn.fit.dnode':
coef(object, ...)
## methods available for "bn.fit.onode"
## S3 method for class 'bn.fit.onode':
coef(object, ...)
## methods available for "bn.fit.gnode"
## S3 method for class 'bn.fit.gnode':
fitted(object, ...)
## S3 method for class 'bn.fit.gnode':
coef(object, ...)
## S3 method for class 'bn.fit.gnode':
residuals(object, ...)
## S3 method for class 'bn.fit.gnode':
sigma(object, ...)
## methods available for "bn.fit.cgnode"
## S3 method for class 'bn.fit.cgnode':
fitted(object, ...)
## S3 method for class 'bn.fit.cgnode':
coef(object, ...)
## S3 method for class 'bn.fit.cgnode':
residuals(object, ...)
## S3 method for class 'bn.fit.cgnode':
sigma(object, ...)
bn.fit, bn.fit.dnode,
bn.fit.gnode, bn.fit.cgnode or bn.fit.onode.k = 1 gives the expression used to compute AIC.TRUE, logLik returns
a vector containing the the log-likelihood of each observations in
the sample. If FALSE, logLik returns a single value,
the likelihood of theTRUE a lot of debugging output
is printed; otherwise the function is completely silent.predict returns a numeric vector (for Gaussian and conditional
Gaussian nodes), a factor (for categorical nodes) or an ordered factor
(for ordinal nodes). logLik returns a numeric vector or a single numeric value, depending
on the value of by.sample. AIC and BIC always return
a single numeric value.
All the other functions return a list with an element for each node in
the network (if object has class bn.fit) or a numeric
vector or matrix (if object has class bn.fit.dnode,
bn.fit.gnode, bn.fit.cgnode or bn.fit.onode).
coef (and its alias coefficients) extracts model
coefficients (which are conditional probabilities for discrete nodes
and linear regression coefficients for Gaussian and conditional
Gaussian nodes). residuals (and its alias resid) extracts model
residuals and fitted (and its alias fitted.values)
extracts fitted values from Gaussian and conditional Gaussian nodes.
If the bn.fit object does not include the residuals or
the fitted values for the node of interest both functions return
NULL.
sigma extracts the standard deviations of the residuals from
Gaussian and conditional Gaussian networks and nodes.
predict returns the predicted values for node given the data
specified by data and the fitted network. Depending on the value of
method, the predicted values are computed as follows.
parents: the predicted values are computed by plugging in
the new values for the parents ofnodein the local probability
distribution ofnodeextracted fromfitted.bayes-lw: the predicted values are computed by averaging
likelihood weighting simulations performed using all the available
nodes as evidence (obviously, with the exception of the node whose
values we are predicting). The number of random samples which are
averaged for each new observation is controlled by thenoptional argument; the default is500. If the variable being
predicted is discrete, the predicted level is that with the highest
conditional probability. If the variable is continuous, the predicted
value is the expected value of the conditional distribution.bn.fit, bn.fit-class.data(gaussian.test)
res = hc(gaussian.test)
fitted = bn.fit(res, gaussian.test)
coefficients(fitted)
coefficients(fitted$C)
str(residuals(fitted))
data(learning.test)
res2 = hc(learning.test)
fitted2 = bn.fit(res2, learning.test)
coefficients(fitted2$E)Run the code above in your browser using DataLab